home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Folder Watching / FW Receiver ƒ / Sources / Lists.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-16  |  1.4 KB  |  97 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        Lists.c
  3.  
  4.     Contains:    List Manager stuff and associated routines
  5.  
  6.     Written by:    Chris White, Developer Technical Support
  7.     
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9.     
  10.     Change History (most recent first):
  11.     
  12.             12/18/95            CW        First release
  13.  
  14. */
  15.  
  16.  
  17. #pragma segment Core
  18.  
  19.  
  20. // System Includes
  21.  
  22.  
  23.  
  24. // Application Includes
  25.  
  26. #ifndef __BAREBONES__
  27.     #include "BareBones.h"
  28. #endif
  29.  
  30. #ifndef __PROTOTYPES__
  31.     #include "Prototypes.h"
  32. #endif
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. Boolean HandleListClick ( WindowRef theWindow, EventRecord* event )
  40. {
  41.     Point        localPt;
  42.     ListRef        theList;
  43.     
  44.     
  45.     localPt = event->where;
  46.     GlobalToLocal ( &localPt );
  47.     theList = (ListRef) GetWRefCon ( theWindow );
  48.     
  49.     if ( (*theList)->lActive == true )
  50.     {
  51.         Rect    listRect;
  52.         
  53.         GetListRect ( theList, &listRect );
  54.         // Include the scroll bars
  55.         listRect.right += 15;
  56.         
  57.         if ( PtInRect ( localPt, &listRect ) )
  58.             LClick ( localPt, event->modifiers, theList );
  59.             
  60.     }
  61.     
  62.     return true;
  63. }
  64.  
  65.  
  66.  
  67. void AddToList ( ListRef theList, Str255 theString )
  68. {
  69.     Rect    dataRect;
  70.     Cell    theCell;
  71.     short    nuRow;
  72.     
  73.     #if DEBUGGING
  74.     if ( theList == nil ) DebugStr ( "\p theList == nil");
  75.     #endif
  76.     
  77.     dataRect = (*theList)->dataBounds;
  78.     nuRow = LAddRow ( 1, dataRect.bottom, theList );
  79.     SetPt ( &theCell, 0, nuRow );
  80.     LSetCell ( &theString[1], theString[0], theCell, theList );
  81.     
  82.     return;
  83. }
  84.  
  85.  
  86.  
  87. void GetListRect ( ListRef theList, Rect* theRect )
  88. {
  89.     *theRect = (*theList)->rView;
  90. }
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.